<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>智能星保障住房信息管理系统</title>
    <link href="__CSS__/common.css" rel="stylesheet" type="text/css" />
    <link href="__CSS__/login2.css" rel="stylesheet" type="text/css" />
    <script src="__JS__/jquery.min.js" type="text/javascript" ></script>
</head>
<body>

<div class="page-login main">
    <div class="area-header">
        <h2>
            <img src="__IMG__/logo.png" />
            智能星保障住房信息管理系统
        </h2>
    </div>
    <div class="area-body">
        <div class="login-box">
            <form id="loginForm" method="post" action="/Home/Login/loginCheck">
                <table>
                    <tr>
                        <td colspan="2">
                            <input id="username" class="form-control input-sm" type="text" placeholder="请输入用户名" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input id="passwd" class="form-control input-sm" type="password" placeholder="请输入密码" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input id="passwd2" onkeydown="KeyDown()" class="form-control input-sm" style="width:120px;" type="text" placeholder="请输入验证码" />
                        </td>
                        <td>
                            <img name="verify" src="/Home/Login/verify/" onclick="fresh_verify_code()" title="点击刷新验证码" alt="点击刷新验证码" />
                        </td>
                    </tr>
                    <tr style="height: 100px;">
                        <td colspan="2">
                            <button onclick="login()" class="btn btn-default" type="button">登 陆</button>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="area-footer">
        <div class="content">
            <p>主办单位：**市房产局</p>
            <p>单位地址：长沙市天心区芙蓉南路生活艺术城519室      办公电话：(0731)85412309</p>
            <p>技术支持：<a href="http://www.letukeji.cn">湖南乐途科技有限公司</a></p>
        </div>
    </div>
</div>
<script type="application/javascript">
    function KeyDown(e)
    {
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13)
        {
            event.returnValue=false;
            event.cancel = true;
            login();
        }
    }

    function fresh_verify_code(){
        var verifyURL = "/Home/Login/verify/";
        var time = new Date().getTime();
        $("img[name=verify]").attr({"src" : verifyURL + "/" + time});
    }

    function login(){
        var username = $("#username").val();
        var passwd = $("#passwd").val();
        var passwd2 = $("#passwd2").val();
        $.ajax({
            type : "post",
            url : $("#loginForm").attr("action"),
            data: {username:username, passwd:passwd, passwd2:passwd2},
            success : function (json){
                if (json.status == 1) {
                    location.href = "/admin/panel";
                }else{
                    alert(json.info);
                    fresh_verify_code();
                }
            }
        });
    }
</script>
</body>
</html>
